package com.lzw.strategy.demo1;

import com.lzw.strategy.demo1.pojo.People;
import com.lzw.strategy.demo1.util.Constant;

/**
 * @author Chengfei
 * @Description
 * @date 2024/5/14
 */
public abstract class AbstractPeopleStrategy implements PeopleStrategy {


    @Override
    public void detail(People people) {

        // 公共业务处理 如性别转换  0-女 1-男 2-待定
        setGenderName(people);

        // 肤色由子类展示
        colour(people);
    }







    /**
     * 如性别转换  0-女 1-男 2-待定
     * @param people
     */
    private void setGenderName(People people) {
        String gender = people.getGender();
        if(Constant.STRING_0.equals(gender)){
            people.setGenderName(Constant.GENDER_NV);
        }else if(Constant.STRING_1.equals(gender)){
            people.setGenderName(Constant.GENDER_NAN);
        }else{
            people.setGenderName(Constant.GENDER_UNKNOWN);
        }
    }

    // 展示肤色

    /**
     * 展示肤色
     * @param people 国籍的人
     */
    protected abstract void colour(People people);



}
